SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

-- =============================================
-- Author:		Lic. Oscar Valente
-- Create date: 27-01-2011
-- Description:	Retorna la fecha sin la hora en una variable del tipo fecha
-- =============================================
CREATE FUNCTION [dbo].[FechaSinHora] 
(
	@fechaConHora datetime
)
RETURNS datetime
AS
BEGIN
	-- Declare the return variable here
	DECLARE @FechaSinHora datetime

	-- Add the T-SQL statements to compute the return value here
	SELECT @FechaSinHora = CAST(CONVERT(VARCHAR(20), @fechaConHora, 112) AS DATETIME) 

	-- Return the result of the function
	RETURN @FechaSinHora

END

GO
